package my.bc.webdav.client;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.StatusLine;
import org.apache.jackrabbit.webdav.client.methods.DavMethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DavResultTypicalHandler implements DavResultHandler
{
  private static final Logger log = LoggerFactory.getLogger( DavResultTypicalHandler.class );

  @Override
  public void onFailed( DavMethod method )
  {
    int statusCode = method.getStatusCode();
    StatusLine sl = method.getStatusLine();
    
    Header[] headers = method.getRequestHeaders();
    log.warn(  "execute method failed: " + method.getName() );
    log.warn( "status code: " + statusCode + "; status line: " + sl );
    log.warn( "Path: " + method.getPath() );
    for( Header header : headers )
    {
      log.debug( header.getName() + ": " + header.getValue() );
    }
    log.warn( "==========================" );
  }

  @Override
  public void onSucceeded( DavMethod method )
  {
  }

}
